
use bevy::prelude::*;
pub struct MapPlugins;

///地图渲染层级
static MAP_RENDERING_LEVEL: f32 = 0.;

impl Plugin for MapPlugins {
    fn build(&self, app: &mut App) {
        app.add_systems(Startup, spawn_map);
    }
}

fn spawn_map(mut com: Commands, asset_server: ResMut<AssetServer>) {
    let player_pos = Vec3::new(0., 0., MAP_RENDERING_LEVEL);
    let player = SpriteBundle {
        texture: asset_server.load("map/wall.png"),
        transform: Transform {
            translation: player_pos,
            rotation: Quat::IDENTITY,
            scale: Vec3::ONE,
        },
        sprite: Sprite {
            custom_size: Some(Vec2::new(1000., 1000.)),
            ..default()
        },
        ..default()
    };
    let mut cmd = com.spawn(player);
    cmd.insert(ImageScaleMode::Tiled { tile_x: (true), tile_y: (true), stretch_value: (1.5) }); 
}
